export function sleep(ms: number = 100): Promise<void> {
    return new Promise((resolve) => setTimeout(resolve, ms));
}
export function formatTime(unixTime: number): string {
    const date = new Date(unixTime);
    const hours = date.getHours().toString().padStart(2, "0");
    const minutes = date.getMinutes().toString().padStart(2, "0");
    const seconds = date.getSeconds().toString().padStart(2, "0");
    const years = date.getFullYear();
    const months = date.getMonth() + 1; // Months are zero-based, so add 1
    const days = date.getDate();
    if (years > 1970) {
        return `${years}-${months}-${days} ${hours}:${minutes}:${seconds}`;
    }
    throw new Error("Invalid time");
}
